home *** CD-ROM | disk | FTP | other *** search
- #VRML V2.0 utf8 - PLATINUM technology, inc. 1997
- #ADD_TOUCH_SENSOR
- #MOVE_OBJ_UNDER_SWITCH
-
- DEF $OBJECT_Switch Switch
- {
- whichChoice 1
- choice
- [
- DEF $OBJECT_SwitchTransform Transform
- {
- children
- [
- Shape
- {
- appearance Appearance {
- material Material {
- specularColor 1 1 1
- diffuseColor 0.8 0.8 0.8
- shininess 0.2
- }
- }
-
- geometry Cone
- {}
- }
- ]
- }
- ]
- }
-
- DEF $OBJECT_SwitchAndMove_pos PositionInterpolator {
- key [0 0.51 1 ]
- keyValue [ 0 0 0 -1.468 0 -4.168 -5.382 0 -18.82 ]
- }
-
- DEF $OBJECT_SwitchTimer TimeSensor {
- enabled TRUE
- startTime 0.0
- stopTime 1.0
- cycleInterval 5
- loop TRUE
- }
-
-
-
- DEF $OBJECT_SwitchAndMoveScr Script
- {
- eventIn SFTime clicked # Object Click event
- eventOut SFTime startTimer # startTime for Timer
- eventOut SFInt32 choice # switch choiceeventOut SFVec3f moveObject # move initial object
-
- url "vrmlscript:
- function clicked (value)
- {
- choice = -1;
- startTimer = value;
- }
- "
- }
-
-
- ROUTE $OBJECTTS.touchTime TO $OBJECT_SwitchAndMoveScr.clicked
- ROUTE $OBJECT_SwitchAndMoveScr.choice TO $OBJECT_Switch.set_whichChoice
- ROUTE $OBJECT_SwitchAndMoveScr.startTimer TO $OBJECT_SwitchTimer.set_startTime
- ROUTE $OBJECT_SwitchTimer.fraction_changed TO $OBJECT_SwitchAndMove_pos.set_fraction
- ROUTE $OBJECT_SwitchAndMove_pos.value_changed TO $OBJECT_SwitchTransform.set_translation